package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zaru extends zart {
   zaru(String var1) {
      this.c = var1;
   }

   void a(String[] var1) {
   }

   void a(zarx var1) throws Exception {
      com.aspose.cells.a.f.zh var2 = var1.a.a(this.c);
      var2.a(DateTime.getNow());
      var1.a.a(var2);
      var1.b = "";
      Iterator var3 = this.d.iterator();

      while(var3.hasNext()) {
         zart var4 = (zart)var3.next();
         var4.a(var1);
      }

      var1.a(var1.b);
   }

   void a(com.aspose.cells.a.f.zi var1, String var2) throws Exception {
      zcfk var3 = new zcfk();
      com.aspose.cells.a.f.zh var4 = var1.a(var2);
      if (var4 != null) {
         zarp var5 = new zarp();
         var3.a(var1.a(var4));
         var5.a = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>";
         this.a((zart)var5);
         this.a((zcfq)var3, (zart)var5);
      }
   }

   zart a(zart var1, ArrayList var2) {
      Iterator var3 = var1.d.iterator();

      zart var4;
      do {
         if (!var3.hasNext()) {
            return null;
         }

         var4 = (zart)var3.next();
      } while(!com.aspose.cells.b.a.zv.b(var4.c, (String)var2.get(var2.size() - 1)));

      if (var2.size() >= 2) {
         var2.remove(var2.size() - 1);
         return this.a(var1, var2);
      } else {
         return var4;
      }
   }

   void a(String var1, zart var2) {
      String[] var3 = var1.replaceFirst("^/", "").split("/");
      ArrayList var4 = new ArrayList();
      com.aspose.cells.b.a.za.b((Object[])var3);
      String[] var5 = var3;
      int var6 = var3.length;

      for(int var7 = 0; var7 < var6; ++var7) {
         String var8 = var5[var7];
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var8);
      }

      zarp var9 = (zarp)this.d.get(0);
      zart var10 = this.a((zart)var9, (ArrayList)var4);
      if (var10 != null) {
         var10.a(var2);
      }

   }

   void a(zcfq var1, zart var2) throws Exception {
      zcfs var3 = var1.j();

      for(int var4 = 0; var4 < var3.a(); ++var4) {
         zcfq var5 = var3.a(var4);
         switch(var5.e) {
         case 1:
            Object var7 = null;
            int var8;
            zcfg var9;
            if (var5.c().endsWith("/>")) {
               var7 = new zarq(var5.i());

               for(var8 = 0; var8 < var5.e().getCount(); ++var8) {
                  var9 = var5.e().a(var8);
                  ((zarq)var7).a.add(new zakr(var9.i(), var9.h));
               }
            } else {
               var7 = new zars(var5.i(), var5.d());

               for(var8 = 0; var8 < var5.e().getCount(); ++var8) {
                  var9 = var5.e().a(var8);
                  ((zars)var7).b.add(new zakr(var9.i(), var9.h));
               }
            }

            var2.a((zart)var7);
            this.a((zcfq)var5, (zart)var7);
         case 2:
         case 3:
         case 4:
         case 5:
         default:
            break;
         case 6:
         case 7:
            zarp var6 = (zarp)((zarp)var2);
            var6.a = var5.c();
            this.a((zcfq)var5, (zart)var6);
         }
      }

   }

   void b(String var1, zart var2) {
      String[] var3 = var1.replaceFirst("^/", "").split("/");
      ArrayList var4 = new ArrayList();
      com.aspose.cells.b.a.za.b((Object[])var3);
      String[] var5 = var3;
      int var6 = var3.length;

      for(int var7 = 0; var7 < var6; ++var7) {
         String var8 = var5[var7];
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var8);
      }

      zarp var10 = (zarp)this.d.get(0);
      zart var11 = this.a((zart)var10, (ArrayList)var4);
      if (var11 != null) {
         zakr var9;
         Iterator var14;
         if (var2 instanceof zarq) {
            zarq var13 = (zarq)var2;
            var14 = var13.a.iterator();

            while(var14.hasNext()) {
               var9 = (zakr)var14.next();
               if ("Id".equals(var9.a)) {
                  var9.b = var9.b + (var11.d.size() + 1);
               }
            }
         } else if (var2 instanceof zars) {
            zars var12 = (zars)var2;
            var14 = var12.b.iterator();

            while(var14.hasNext()) {
               var9 = (zakr)var14.next();
               if ("Id".equals(var9.a)) {
                  var9.b = var9.b + (var11.d.size() + 1);
               }
            }
         }

         var11.a(var2);
      }

   }
}
